%format latex or latex2e
\ifx\documentclass\undefined
  \documentstyle[11pt,supertabular]{article}
\else
  \documentclass[11pt]{article}
  \usepackage{supertabular}
\fi
%  4-FEB-91     JLB     Adapted this file to the additions made to the
%                       style file.
%  3-JUN-91     RmS     Changed into a proper LaTeX input file
\setlength{\topmargin}{0cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\textheight}{23cm}
\setlength{\textwidth}{15cm}
\newcommand{\tbsp}{\rule{0pt}{18pt}}
                  % I use \tbsp to get a vertical distance after \hline
\begin{document}
\section{The Supertabular}
Here is the description of a new style file called \verb|supertab|.
This new style offers a new environment, the \verb|supertabular|
environment. As the name says it is an extension of the normal
\verb|tabular| environment.

With the original \verb|tabular| environment a tabular must always fit
on {\it one} page. If the tabular becomes too large the text overwrites
the page's bottom margin and you get an \verb|Overfull vbox| message.

The \verb|supertabular| environment uses the \verb|tabular| environment
internally, but it evaluates the used space every time it gets a
\verb|\\| command. If the tabular reaches the textheight,
it automatically inserts an \verb|\end{tabular}| command, starts a new
page and inserts the tablehead on the new page continuing the tabular.

New commands to use with \verb|supertabular| are:
\begin{center}
\begin{tabular}{l p{8cm}}
\verb|\tablefirsthead{...}| & defines the contents of the first occurence of
                            the tabular head.
                            The use of this command is optional.
                         Don't forget to close the head by a \verb|\\|
                         or \verb|\newline|.                        \\
\verb|\tablehead{...}| & defines the contents of all subsequent ocurrences of
                         the tabular head.
                         Don't forget to close the head by a \verb|\\|
                         or \verb|\newline|.                        \\
\verb|\tabletail{...}| & defines something which should be inserted
                         before each \verb|\end{tabular}|, except the last.\\
\verb|\tablelasttail{...}| & defines something which should be inserted
                             before the last \verb|\end{tabular}|.
                             The use of this command is optional.\\
\verb|\topcaption{...}|     &\\
\verb|\bottomcaption{...}|  &\\
\verb|\tablecaption{...}|   & Provide a caption for the super-table, either
                              at the top or at the bottom of the table. When
                              \verb|\tablecaption| is used the caption will
                              be placed at the default location, which is at
                              the top.\\
\end{tabular}
\end{center}
Note that you define new lines inside the supertabular as normal by
\verb|\\| or \verb|\\[...pt]|. All column definition commands can be
used, including \verb|@{...}| and \verb|p{...}|. You can {\it not} use
the optional positioning argument and the width argument which are
possible with the \verb|\begin{tabular}| command.

Here is an example of a supertabular. You will find the definitions at
the end of the supertabular.
\begin{center}
\tablefirsthead{\hline  \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tablehead{\hline \multicolumn{4}{|l|}{\small\sl continued from previous page}\\
           \hline \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tabletail{\hline\multicolumn{4}{|r|}{\small\sl continued on next page}\\\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\par
\begin{supertabular}{| r@{\hspace{6.5mm}}| r@{\hspace{5.5mm}}| r | r|}
1   &     1  &        1  &           1    \\
2   &     4  &       16  &           2    \\
3   &     9  &       81  &           6    \\
4   &    16  &      256  &          24    \\[5mm]
5   &    25  &      625  &         120    \\
6   &    36  &     1296  &         720    \\
7   &    49  &     2401  &        5040    \\
8   &    64  &     4096  &       40320    \\
9   &    81  &     6561  &      362880    \\
10  &   100  &    10000  &     3628800    \\
11  &   121  &    14641  &    39916800    \\
12  &   144  &    20736  &   479001600    \\[.5cm]
\hline & & & \\
13  &   169  &    28561  &  6.22702080E+9 \\[1cm]
14  &   196  &    38416  &  8.71782912E+10\\
15  &   225  &    50625  &  1.30767437E+12\\
16  &   256  &    65536  &  2.09227899E+13\\
17  &   289  &    83521  &  3.55687428E+14\\[5mm]
18  &   324  &   104976  &  6.40237370E+15\\
19  &   361  &   130321  &  1.21645100E+17\\
20  &   400  &   160000  &  2.43290200E+18\\
\end{supertabular}
\end{center}
And here are the definitions:
\begin{verbatim}
\newcommand{\tbsp}{\rule{0pt}{18pt}}
                  % I use \tbsp to get a vertical distance after \hline
\tablefirsthead{\hline  \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tablehead{\hline \multicolumn{4}{|l|}%
                {\small\sl continued from previous page}\\
           \hline \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tabletail{\hline\multicolumn{4}{|r|}%
                {\small\sl continued on next page}\\\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\begin{supertabular}{| r@{\hspace{6.5mm}}| r@{\hspace{5.5mm}}| r | r|}
1   &     1  &        1  &           1    \\
2   &     4  &       16  &           2    \\
3   &     9  &       81  &           6    \\
4   &    16  &      256  &          24    \\[5mm]
...
19  &   361  &   130321  &  1.21645100E+17\\
20  &   400  &   160000  &  2.43290200E+18\\
\end{supertabular}
\end{verbatim}

Here is another example whith a {\tt p} column-definition. The tablehead
is the same as above. The tabletail is a double \verb|\hline|
\verb|\arraystretch| is set to {\tt 1.5} and font size is \verb|\small|.
\begin{center}
\tablelasttail{\hline\hline}
\topcaption{This table should also be split accross pages.}
\renewcommand{\arraystretch}{1.5}
\small
\begin{supertabular}{| r@{\hspace{6.5mm}}| r@{\hspace{5.5mm}}| r p{5cm}|}
1  &  1  &  1  &  here is a relative short entry \\
2  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
3  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
4  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
5  &  1  &  1  &  here is a relative short entry \\
6  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
7  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
8  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
9  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
10 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
11 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
12 &  1  &  1  &  here is a relative short entry \\
13 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
14 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
15 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
16 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
17 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
18 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
\end{supertabular}
\end{center}

Here is the same table again, but this time using the supertabular*
environment and stretching the table to the full width of the text.

\begin{center}
\tablelasttail{\hline\hline}
\renewcommand{\arraystretch}{1.5}
\small
\begin{supertabular*}{\textwidth}%
                     {| r@{\extracolsep{6.5mm plus 1fil}}|
                        r@{\extracolsep{5.5mm plus 0.5fil}}|
                        r@{\extracolsep{0mm plus 0.1fil}} p{5cm}|}
1  &  1  &  1  &  here is a relative short entry \\
2  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
3  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
4  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
5  &  1  &  1  &  here is a relative short entry \\
6  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
7  &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
8  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
9  &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
10 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
11 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
12 &  1  &  1  &  here is a relative short entry \\
13 &  1  &  1  &  here is also a long entry, where also a line break
                  should occur\\
14 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
15 &  1  &  1  &  and here is a long entry, where line breaks and line
                  breaks and line breaks have to occur \\
\end{supertabular*}
\end{center}

\section{Known problems}

\begin{itemize}
\item When a float occurs on the same page as the start of a
  supertabular you can expect unexpected results.

  When the float was defined on the same page you might end up with
  the first part of the supertabular on a page by its own.

\item You should not use the supertabular {\em inside\/} a
  floating-environment such as {\tt table} as this will result in
  \TeX\ trying to put the whole supertabular on {\em one\/} page.

\item In some instances you might still end up with overfull
  \verb=\vbox= messages. These instances are described in the
  (documented version of) the style file itself.

\item Sometimes the last page of the supertabular contains just an
  empty head an tail.
\end{itemize}

\end{document}
